﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace BBPA.BLL
{
    public class Stat
    {
        /// <summary>
        /// 统计数据+1
        /// </summary>
        /// <param name="TableName_">表名</param>
        /// <param name="columnName_">列名</param>
        //public static void Increase1(object TableName_, object columnName_) { IncreaseN(TableName_, columnName_, 1); }
        /// <summary>
        /// 统计数据+1
        /// </summary>
        /// <param name="TableName_">表名</param>
        /// <param name="columnName_">列名</param>
        /// <param name="RowID_">要计算的主数据ID</param>
        public static void Increase1(object TableName_, object columnName_, int RowID_) { IncreaseN(TableName_, columnName_, RowID_,1); }


        /// <summary>
        /// 统计数据+N
        /// </summary>
        /// <param name="TableName_">表名</param>
        /// <param name="columnName_">要操作的列名</param>
        /// <param name="addNum_">要加的N</param>
        //public static void IncreaseN(object TableName_, object columnName_,  object addNum_)
        //{
        //    IncreaseN(TableName_, columnName_, 0, addNum_);
        //}
        /// <summary>
        /// 统计数据+N
        /// </summary>
        /// <param name="TableName_">表名</param>
        /// <param name="columnName_">要操作的列名</param>
        /// <param name="RowID_">要计算的主数据ID</param>
        /// <param name="addNum_">要加的N</param>
        public static void IncreaseN(object TableName_, object columnName_ , int RowID_, object addNum_)
        {
            if (addNum_ == null) return;
            DAL.Stat.Increase(TableName_.ToString(), columnName_.ToString(), RowID_,addNum_);
            if (RowID_ > 0) DAL.Stat.Increase(TableName_.ToString(), columnName_.ToString(), 0, addNum_);
        }
    }
}
